import request from '@/utils/request'

/**
 * 获取课程列表信息。
 */
export const getCourseList = (params, current, limit, companyId) => {
  return request({
    url: '/edu/videoCourse/pageVideoCourseCondition/' + companyId + '/' + current + '/' + limit,
    method: 'post',
    data: params
  })
}

/**
 * 获取所有课程列表。
 */
export const getAllCourse = (companyId) => {
  return request({
    url: '/edu/videoCourse/getVideoCourse/' + companyId,
    method: 'get',
  })
}

//获取课程职级以及对应ID
export const getGrade = () => {
  return request({
    url: '/eduM2/eduGrade/getCourse',
    method: 'get'
  })
}

/**
 * 根据课程id查询课程基本信息
 * @returns 
 */
export const getCourseInfoId = (courseId) => {
  return request({
    url: `/edu/videoCourse/getCourseInfo/${courseId}`,
    method: 'get'
  })
}

/**
 * 根据课程id查询发布课程的最终确认信息
 * @returns 
 */
export const getPublishCourseInfo = (courseId) => {
  return request({
    url: `/edu/videoCourse/getPublishCourseInfo/${courseId}`,
    method: 'get'
  })
}

/**
 * 最终发布课程
 * @param {*} courseId 
 * @returns 
 */
export const publihCourse = (Id) => {
  return request({
    url: `/edu/videoCourse/publishCourse/${Id}`,
    method: 'get',
  })
}

/**
 * 下架课程
 * @param {*} courseId 
 * @returns 
 */
export const unpublihCourse = (Id) => {
  return request({
    url: `/edu/videoCourse/unpublishCourse/${Id}`,
    method: 'get',
  })
}

/**
 * 添加课程信息
 * @param {*} courseInfo 
 * @returns 
 */
export const addCourseInfo = (courseInfo) => {
  return request({
    url: '/edu/videoCourse/addVideoCourse',
    method: 'post',
    data: courseInfo
  })
}

/**
 * 修改课程信息
 * @param {*} courseInfo 
 * @returns 
 */
export const updateCourseInfo = (courseInfo) => {
  return request({
    url: '/edu/videoCourse/updateVideoCourse',
    method: 'post',
    data: courseInfo
  })
}

/**
 * 删除课程
 */
export const deleteCourseById = (courseid) => {
  return request({
    url: `/edu/videoCourse/deleteVideoCourse/${courseid}`,
    method: 'delete'
  })
}


